package day03;

import java.io.IOException;
import java.net.URLEncoder;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

public class DemoRedirect extends HttpServlet{
	
	@Override
	protected void doGet(HttpServletRequest req, HttpServletResponse response) throws ServletException, IOException {
		
		String parameter = req.getParameter("name");
		
		response.setStatus(HttpServletResponse.SC_FOUND);

		
		response.setHeader("Location", "request?name=" + URLEncoder.encode(parameter, "utf-8"));
	}
	
}
